package com.ziytek.web.citizen.config;

import lombok.RequiredArgsConstructor;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.List;

/**
 * @author fenghx
 */
@Component
@RefreshScope
@RequiredArgsConstructor
public class ThreadPrintConfigInit {

    private final PrintThreadConfig printThreadConfig;

    public ThreadConfig getThreadConfig() {
        List<ThreadConfig> configs = printThreadConfig.getThreadConfigs();
        return CollectionUtils.isEmpty(configs) ? null : configs.getFirst();
    }
}
